home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Technology Seed 1996 September / Macintosh Technology Seed (September 1996) (CDRM1437020).ISO / pc / qd3d15d6 / 15d6_sdk.exe / QD3D Win32 1.5d6 / Interfaces / QD3DDrawContext.h < prev    next >
C/C++ Source or Header  |  1996-08-21  |  14KB  |  449 lines

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DDrawContext.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:    Draw context class types and routines                        **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1993-1996 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DDrawContext_h
  15. #define QD3DDrawContext_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  22.  
  23. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  24.     #pragma options enum=small
  25. #endif
  26.     #include <Quickdraw.h>
  27.     #include <FixMath.h>
  28.     #include <GXTypes.h>
  29. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  30.     #pragma options enum=reset
  31. #endif
  32.  
  33. #endif /* WINDOW_SYSTEM_MACINTOSH */
  34.  
  35. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  36.     #include <X11/Xlib.h>
  37.     #include <X11/Xutil.h>
  38. #endif /* WINDOW_SYSTEM_X11 */
  39.  
  40. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  41.     #include <windows.h>
  42.     #include <ddraw.h>
  43. #endif  /*  WINDOW_SYSTEM_WIN32  */
  44.  
  45. #if defined(THINK_C) || defined(__SC__)
  46.     #pragma options(!pack_enums, !align_arrays)
  47.     #pragma SC options align=power
  48. #elif defined(__MWERKS__)
  49.     #pragma enumsalwaysint on
  50.     #pragma align_array_members off
  51.     #pragma options align=native
  52. #elif defined(__PPCC__)
  53.     #pragma options align=power
  54. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  55.     #pragma options enum=int
  56. #endif
  57.  
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif /*  __cplusplus  */
  61.  
  62.  
  63. /******************************************************************************
  64.  **                                                                             **
  65.  **                            DrawContext Data Structures                         **
  66.  **                                                                             **
  67.  *****************************************************************************/
  68.  
  69. typedef enum TQ3DrawContextClearImageMethod{
  70.     kQ3ClearMethodNone,
  71. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  72.     kQ3ClearMethodWithColor,
  73.     kQ3ClearMethodWithShader
  74. #else
  75.     kQ3ClearMethodWithColor
  76. #endif /* ESCHER_VER_FUTURE */
  77. } TQ3DrawContextClearImageMethod;
  78.  
  79.  
  80. typedef struct TQ3DrawContextData {
  81.     TQ3DrawContextClearImageMethod    clearImageMethod;
  82.     TQ3ColorARGB                    clearImageColor;
  83.     TQ3Area                            pane;
  84.     TQ3Boolean                        paneState;
  85.     TQ3Bitmap                        mask;
  86.     TQ3Boolean                        maskState;
  87.     TQ3Boolean                        doubleBufferState;
  88. } TQ3DrawContextData;
  89.  
  90.  
  91. /******************************************************************************
  92.  **                                                                             **
  93.  **                                DrawContext Routines                         **
  94.  **                                                                             **
  95.  *****************************************************************************/
  96.  
  97. QD3D_EXPORT TQ3ObjectType Q3DrawContext_GetType(
  98.     TQ3DrawContextObject        drawContext);
  99.  
  100. QD3D_EXPORT TQ3Status Q3DrawContext_SetData(
  101.     TQ3DrawContextObject        context,
  102.     const TQ3DrawContextData    *contextData);
  103.  
  104. QD3D_EXPORT TQ3Status Q3DrawContext_GetData(
  105.     TQ3DrawContextObject        context,
  106.     TQ3DrawContextData            *contextData);
  107.     
  108. QD3D_EXPORT TQ3Status Q3DrawContext_SetClearImageColor(
  109.     TQ3DrawContextObject        context,
  110.     const TQ3ColorARGB             *color);
  111.  
  112. QD3D_EXPORT TQ3Status Q3DrawContext_GetClearImageColor(
  113.     TQ3DrawContextObject        context,
  114.     TQ3ColorARGB                 *color);
  115.  
  116. QD3D_EXPORT TQ3Status Q3DrawContext_SetPane(
  117.     TQ3DrawContextObject        context,
  118.     const TQ3Area                 *pane);
  119.  
  120. QD3D_EXPORT TQ3Status Q3DrawContext_GetPane(
  121.     TQ3DrawContextObject        context,
  122.     TQ3Area                         *pane);
  123.  
  124. QD3D_EXPORT TQ3Status Q3DrawContext_SetPaneState(
  125.     TQ3DrawContextObject        context,
  126.     TQ3Boolean                    state);
  127.  
  128. QD3D_EXPORT TQ3Status Q3DrawContext_GetPaneState(
  129.     TQ3DrawContextObject        context,
  130.     TQ3Boolean                    *state);
  131.         
  132. QD3D_EXPORT TQ3Status Q3DrawContext_SetClearImageMethod(
  133.     TQ3DrawContextObject            context,
  134.     TQ3DrawContextClearImageMethod     method);
  135.         
  136. QD3D_EXPORT TQ3Status Q3DrawContext_GetClearImageMethod(
  137.     TQ3DrawContextObject            context,
  138.     TQ3DrawContextClearImageMethod     *method);
  139.         
  140. QD3D_EXPORT TQ3Status Q3DrawContext_SetMask(
  141.     TQ3DrawContextObject        context,
  142.     const TQ3Bitmap                *mask);
  143.         
  144. QD3D_EXPORT TQ3Status Q3DrawContext_GetMask(
  145.     TQ3DrawContextObject        context,
  146.     TQ3Bitmap                    *mask);
  147.  
  148. QD3D_EXPORT TQ3Status Q3DrawContext_SetMaskState(
  149.     TQ3DrawContextObject        context,
  150.     TQ3Boolean                    state);
  151.  
  152. QD3D_EXPORT TQ3Status Q3DrawContext_GetMaskState(
  153.     TQ3DrawContextObject        context,
  154.     TQ3Boolean                    *state);
  155.  
  156. QD3D_EXPORT TQ3Status Q3DrawContext_SetDoubleBufferState(
  157.     TQ3DrawContextObject        context,
  158.     TQ3Boolean                     state);
  159.  
  160. QD3D_EXPORT TQ3Status Q3DrawContext_GetDoubleBufferState(
  161.     TQ3DrawContextObject        context,
  162.     TQ3Boolean                     *state);
  163.  
  164.  
  165. /******************************************************************************
  166.  **                                                                             **
  167.  **                            Pixmap Data Structure                             **
  168.  **                                                                             **
  169.  *****************************************************************************/
  170.  
  171. typedef struct TQ3PixmapDrawContextData {
  172.     TQ3DrawContextData        drawContextData;
  173.     TQ3Pixmap                pixmap;
  174. } TQ3PixmapDrawContextData;
  175.  
  176.  
  177. /******************************************************************************
  178.  **                                                                             **
  179.  **                        Pixmap DrawContext Routines                             **
  180.  **                                                                             **
  181.  *****************************************************************************/
  182.  
  183. QD3D_EXPORT TQ3DrawContextObject Q3PixmapDrawContext_New(
  184.     const TQ3PixmapDrawContextData    *contextData);
  185.  
  186. QD3D_EXPORT TQ3Status Q3PixmapDrawContext_SetPixmap(
  187.     TQ3DrawContextObject            drawContext,
  188.     const TQ3Pixmap                    *pixmap);
  189.  
  190. QD3D_EXPORT TQ3Status Q3PixmapDrawContext_GetPixmap(
  191.     TQ3DrawContextObject            drawContext,
  192.     TQ3Pixmap                        *pixmap);
  193.  
  194. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  195.  
  196. /******************************************************************************
  197.  **                                                                             **
  198.  **                        Macintosh DrawContext Data Structures                 **
  199.  **                                                                             **
  200.  *****************************************************************************/
  201.  
  202. typedef enum TQ3MacDrawContext2DLibrary {
  203.     kQ3Mac2DLibraryNone,
  204.     kQ3Mac2DLibraryQuickDraw,
  205.     kQ3Mac2DLibraryQuickDrawGX
  206. } TQ3MacDrawContext2DLibrary;
  207.  
  208.  
  209. typedef struct TQ3MacDrawContextData {
  210.     TQ3DrawContextData            drawContextData;
  211.     CWindowPtr                    window;
  212.     TQ3MacDrawContext2DLibrary    library;
  213.     gxViewPort                    viewPort;
  214.     CGrafPtr                    grafPort;
  215. } TQ3MacDrawContextData;
  216.  
  217.  
  218. /******************************************************************************
  219.  **                                                                             **
  220.  **                        Macintosh DrawContext Routines                         **
  221.  **                                                                             **
  222.  *****************************************************************************/
  223.  
  224. QD3D_EXPORT TQ3DrawContextObject Q3MacDrawContext_New(
  225.     const TQ3MacDrawContextData    *drawContextData);
  226.     
  227. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetWindow(
  228.     TQ3DrawContextObject        drawContext,
  229.     const CWindowPtr            window);
  230.  
  231. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetWindow(
  232.     TQ3DrawContextObject        drawContext,
  233.     CWindowPtr                    *window);
  234.  
  235. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetGXViewPort(
  236.     TQ3DrawContextObject        drawContext,
  237.     const gxViewPort            viewPort);
  238.  
  239. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetGXViewPort(
  240.     TQ3DrawContextObject        drawContext,
  241.     gxViewPort                    *viewPort);
  242.  
  243. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetGrafPort(
  244.     TQ3DrawContextObject        drawContext,
  245.     const CGrafPtr                grafPort);
  246.  
  247. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetGrafPort(
  248.     TQ3DrawContextObject        drawContext,
  249.     CGrafPtr                    *grafPort);
  250.  
  251. QD3D_EXPORT TQ3Status Q3MacDrawContext_Set2DLibrary(
  252.     TQ3DrawContextObject        drawContext,
  253.     TQ3MacDrawContext2DLibrary    library);
  254.  
  255. QD3D_EXPORT TQ3Status Q3MacDrawContext_Get2DLibrary(
  256.     TQ3DrawContextObject        drawContext,
  257.     TQ3MacDrawContext2DLibrary    *library);
  258.  
  259. #endif /* WINDOW_SYSTEM_MACINTOSH */
  260.  
  261. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  262.  
  263. /******************************************************************************
  264.  **                                                                             **
  265.  **                                Types                                         **
  266.  **                                                                             **
  267.  *****************************************************************************/
  268.  
  269. typedef struct TQ3XBufferData *TQ3XBufferObject;
  270.  
  271. typedef struct TQ3XColormapData {
  272.     long        baseEntry;
  273.     long        maxRed;
  274.     long        maxGreen;
  275.     long        maxBlue;
  276.     long        multRed;
  277.     long        multGreen;
  278.     long        multBlue;
  279. } TQ3XColormapData;
  280.  
  281.  
  282. typedef struct TQ3XDrawContextData {
  283.     TQ3DrawContextData        contextData;
  284.     Display                    *display;
  285.     Drawable                drawable;
  286.     Visual                    *visual;
  287.     Colormap                cmap;
  288.     TQ3XColormapData        *colorMapData;
  289. } TQ3XDrawContextData;
  290.  
  291.  
  292. /******************************************************************************
  293.  **                                                                             **
  294.  **                            XDrawContext Routines                             **
  295.  **                                                                             **
  296.  *****************************************************************************/
  297.  
  298. #ifdef XDC_OLD
  299. QD3D_EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  300.     void);
  301.  
  302. QD3D_EXPORT void Q3XDrawContext_Set(
  303.     TQ3DrawContextObject    drawContext,
  304.     unsigned long            flag,                             
  305.     void                    *data);
  306.  
  307. QD3D_EXPORT void Q3XDrawContext_Get(
  308.     TQ3DrawContextObject    drawContext,
  309.     unsigned long            flag,                             
  310.     void                    *data);
  311. #endif  /* XDC_OLD */
  312.  
  313. QD3D_EXPORT TQ3XBufferObject Q3XBuffers_New(
  314.     Display                    *dpy,                       
  315.     unsigned long            numBuffers,
  316.     Window                    window);
  317.  
  318. QD3D_EXPORT void Q3XBuffers_Swap(
  319.     Display                    *dpy,
  320.     TQ3XBufferObject        buffers);
  321.  
  322. QD3D_EXPORT XVisualInfo *Q3X_GetVisualInfo(
  323.     Display                    *dpy,
  324.     Screen                    *screen);
  325.  
  326.  
  327. QD3D_EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  328.     const TQ3XDrawContextData    *xContextData);
  329.  
  330. QD3D_EXPORT TQ3Status Q3XDrawContext_SetDisplay(
  331.     TQ3DrawContextObject        drawContext,
  332.     const Display                *display);
  333.  
  334. QD3D_EXPORT TQ3Status Q3XDrawContext_GetDisplay(
  335.     TQ3DrawContextObject        drawContext,
  336.     Display                        **display);
  337.  
  338. QD3D_EXPORT TQ3Status Q3XDrawContext_SetDrawable(
  339.     TQ3DrawContextObject        drawContext,
  340.     Drawable                    drawable);
  341.  
  342. QD3D_EXPORT TQ3Status Q3XDrawContext_GetDrawable(
  343.     TQ3DrawContextObject        drawContext,
  344.     Drawable                    *drawable);
  345.  
  346. QD3D_EXPORT TQ3Status Q3XDrawContext_SetVisual(
  347.     TQ3DrawContextObject        drawContext,
  348.     const Visual                *visual);
  349.  
  350. QD3D_EXPORT TQ3Status Q3XDrawContext_GetVisual(
  351.     TQ3DrawContextObject        drawContext,
  352.     Visual                        **visual);
  353.  
  354. QD3D_EXPORT TQ3Status Q3XDrawContext_SetColormap(
  355.     TQ3DrawContextObject        drawContext,
  356.     Colormap                    colormap);
  357.  
  358. QD3D_EXPORT TQ3Status Q3XDrawContext_GetColormap(
  359.     TQ3DrawContextObject        drawContext,
  360.     Colormap                    *colormap);
  361.  
  362. QD3D_EXPORT TQ3Status Q3XDrawContext_SetColormapData(
  363.     TQ3DrawContextObject        drawContext,
  364.     const TQ3XColormapData        *colormapData);
  365.  
  366. QD3D_EXPORT TQ3Status Q3XDrawContext_GetColormapData(
  367.     TQ3DrawContextObject        drawContext,
  368.     TQ3XColormapData            *colormapData);
  369.  
  370. #endif /* WINDOW_SYSTEM_X11 */
  371.  
  372. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  373.  
  374. /******************************************************************************
  375.  **                                                                             **
  376.  **                                Types                                         **
  377.  **                                                                             **
  378.  *****************************************************************************/
  379.  
  380. typedef struct TQ3Win32DCDrawContextData {
  381.     TQ3DrawContextData        drawContextData;
  382.     HDC                        hdc;
  383. } TQ3Win32DCDrawContextData;
  384.  
  385. typedef struct TQ3DDSurfaceDrawContextData {
  386.     TQ3DrawContextData        drawContextData;
  387.     LPDIRECTDRAW            lpDirectDraw;
  388.     LPDIRECTDRAWSURFACE        lpDirectDrawSurface;
  389. } TQ3DDSurfaceDrawContextData;
  390.  
  391.  
  392. /******************************************************************************
  393.  **                                                                             **
  394.  **                            Win32DC DrawContext Routines                     **
  395.  **                                                                             **
  396.  *****************************************************************************/
  397.  
  398. QD3D_EXPORT TQ3DrawContextObject Q3Win32DCDrawContext_New(
  399.     const TQ3Win32DCDrawContextData    *drawContextData);
  400.  
  401. QD3D_EXPORT TQ3Status Q3Win32DCDrawContext_SetDC(
  402.     TQ3DrawContextObject        drawContext,
  403.     const HDC                    hdc);
  404.  
  405. QD3D_EXPORT TQ3Status Q3Win32DCDrawContext_GetDC(
  406.     TQ3DrawContextObject        drawContext,
  407.     HDC                            *hdc);
  408.  
  409.  
  410. /******************************************************************************
  411.  **                                                                             **
  412.  **                            DDSurface DrawContext Routines                     **
  413.  **                                                                             **
  414.  *****************************************************************************/
  415.  
  416. QD3D_EXPORT TQ3DrawContextObject Q3DDSurfaceDrawContext_New(
  417.     const TQ3DDSurfaceDrawContextData    *drawContextData);
  418.  
  419. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_SetDirectDraw(
  420.     TQ3DrawContextObject        drawContext,
  421.     const LPDIRECTDRAW            lpDirectDraw);
  422.  
  423. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_GetDirectDraw(
  424.     TQ3DrawContextObject        drawContext,
  425.     LPDIRECTDRAW                *lpDirectDraw);
  426.  
  427. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_SetDirectDrawSurface(
  428.     TQ3DrawContextObject        drawContext,
  429.     const LPDIRECTDRAWSURFACE    lpDirectDrawSurface);
  430.  
  431. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_GetDirectDrawSurface(
  432.     TQ3DrawContextObject        drawContext,
  433.     LPDIRECTDRAWSURFACE            *lpDirectDrawSurface);
  434.  
  435. #endif  /*  WINDOW_SYSTEM_WIN32  */
  436.  
  437.  
  438. #ifdef __cplusplus
  439. }
  440. #endif /*  __cplusplus  */
  441.  
  442. #if defined(__MWERKS__)
  443.     #pragma enumsalwaysint reset
  444. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  445.     #pragma options enum=reset
  446. #endif
  447.  
  448. #endif  /*  QD3DDrawContext_h  */
  449.